<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
    <h:head> 
        <title>Facelet Title </title>
    </h:head>
    <h:body>
        <ui:composition template="TemplatePrincipal.xhtml">
            <ui:define name="content">
        <f:view>


            <h:form>
                <h:outputLink value="javascript:void(0)" onclick="PF('dlg').show();" title="login">
                    <p:graphicImage name="../imagenes/usuario.png" dir="C:/Users/SOFY/Documents/NetBeansProjects/SSRP/imagenes/usuario.png"/>
    </h:outputLink>
 
    <p:growl id="growl" sticky="true" showDetail="true" life="3000" />
 
    <p:dialog header="Login" widgetVar="dlg" resizable="false">
                <!--h1><h:outputText value="Create/Edit"/></h1-->
                <h:panelGrid columns="2" cellpadding="5">
                    
                    <h:outputLabel value="NÚMERO DE CONTROL:" for="numControl"  />
                    <p:inputText id="numControl" value="#{login.usuario}" title="NumControl" required="true" requiredMessage="The NumControl field is required.">
                           
                                        </p:inputText> 
                    <h:outputLabel value="CONTRASEÑA:" for="contrasena" />
                    <p:inputText id="contrasena" value="#{login.contrasena}" title="Contrasena" required="true" requiredMessage="The Contrasena field is required.">
                       
                                        </p:inputText> 
                    
                    <f:facet name="footer">
                <p:commandButton value="LOGIN" update="growl" actionListener="#{login.login}"
                                 oncomplete="handleLoginRequest(xhr, status, args)" />
            </f:facet>
                </h:panelGrid>
                 </p:dialog>
            </h:form>
            <script type="text/javascript">
    function handleLoginRequest(xhr, status, args) {
        if(args.validationFailed || !args.loggedIn) {
            PF('dlg').jq.effect("shake", {times:5}, 100);
        }
        else {
            PF('dlg').hide();
            $('#loginLink').fadeOut();
        }
    }
</script>
        </f:view>
            </ui:define>
        </ui:composition>
    </h:body>
</html>

